home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 31 / Amiga Format CD31 (1998-09-02)(Future Publishing)(GB)(Track 1 of 2)[!][issue 1998-10].iso / -seriously_amiga- / hardware / domount / mnt.rexx < prev    next >
OS/2 REXX Batch file  |  1998-07-20  |  8KB  |  3 lines

  1. /*  $VER: 1.0 for DoMount v1.0
  2. */
  3. ;ShowMe =                          0x80429ba8;Selected=0x8042654b;options results;call getenv(sysn);sys=result;say sys"=sys" length(sys);arg cmd;say cmd;address mntprfs;popasl ID PPST;scsidev=result;call setenv(scsid,scsidev);slider ID PPSLD;scsiunit=result;group ID BSY ATTRS showme 1;call getclip(red);say 'red='result;if cmd=cmnt then call cancel;call getclip(devmnt);say 'devmnt='result;if result=1 then call mountdevice;if result=2 then call dismountdevice(sys);if cmd=wno then call wno;if cmd=wyes then call dismountsys;if cmd=read it then call read;if cmd=read units then call readunit;if cmd=mount then call mount;if cmd=dismount then call dismount;if cmd=mntd then call setdev;if cmd=dmntd then call setdev;if cmd=quit then call quit;call exit;read:    say read;call setclip(devmnt,0);call setclip(red,1);if exists('ram:file') then call cleanup;                     say back;address command 'rdbinfo 'scsidev scsiunit '>ram:file';scsidev=" device         ="||scsidev;scsiunit=" unit           ="||scsiunit;call open(dfile,'ram:devfile','w');call writeln(dfile,'');call close(dfile);call open(dfile,'ram:devfile','a');call open(mfile,'ram:mountfile','w');call writeln(mfile,'');call close(mfile);call open(mfile,'ram:mountfile','a');call open(nfile,'ram:file','r');do while ~eof(nfile);parse value readln(nfile) with line;parse value line with "Partition Block at block" num garb; if num ~="" then;do; parse value readln(nfile) with part dev; call writeln(dfile,dev);say dev; call writeln(mfile,dev);say scsidev; call writeln(mfile,scsidev);say scsiunit; call writeln(mfile,scsiunit); parse value readln(nfile) with ln; parse value ln with what "=" hex "=";  hex=strip(hex,'b',' $');  dig=x2d(hex);   dig="="||dig;   newline= what||dig;   call writeln(mfile,newline);      say what dig;;do i=1 to 6;   parse value readln(nfile) with junk;   end;;do i=1 to 10;   parse value readln(nfile) with line;   parse value line with what "=" junk "=" num junk;   if what="SectorPerBlock" then what=" SectorsPerBlock";   if what="NumBuffers" then what=" Buffers";   num="="||num;   newline=what||num;   call writeln(mfile,newline); say what num;   end;;do i=1 to 2;   parse value readln(nfile) with what "=" hex "=" junk;   hex=strip(hex,'b',' $');   hex=right(hex,length(hex)-2);   hex="=0x"||hex;   newline=what||hex;   call writeln(mfile,newline);say what hex;   end;   parse value readln(nfile) with line;   parse value line with what "=" junk "=" num junk;   num="="||num;   newline=what||num;   call writeln(mfile,newline); say what num;   parse value readln(nfile) with what "=" hex "=" junk;   hex=strip(hex,'b',' $');   hex="=0x"||hex;   newline=what||hex;   call writeln(mfile,newline);say what hex;   newline=" Activate          =1";   call writeln(mfile,newline);   call writeln(mfile,'#'); end;end;call close(file);call close(mfile);call close(dfile);call unitlist;unitlist:     say 'unitlist';call close(dfile);  if exists('ram:devfile') then;do;call open(dfile,'ram:devfile','r');parse value readln(dfile) with name;address mntprfs;list ID DLST STRING;do while ~eof(dfile);parse value readln(dfile) with name; parse value name with " "name":"junk;name=name":";say name"=name" length(name);if name~="" then;do;address command "volname volume "name ">env:vnm";call getenv(vnm);vname=result;parse value vname with vname":"junk;vname=vname":";say vname length(vname);if vname=name then vname='Not Mounted';nname=name","vname;say nname;end;if name ~=":" then list ID DLST INSERT POS List_Insert_Bottom STRING nname;if name =":" then call exit;end;end;group ID BSY ATTRS showme 0;exit;cleanup:;address command 'delete ram:file';address command 'delete ram:devfile';address command 'delete ram:mountfile';address command 'delete ram:ufile';return;readunit:;  address mntprfs;  list ID ULST STRING;do i=0 to 6;if exists('ram:ufile') then;do;address command 'delete ram:ufile';end;address command 'rdbinfo 'scsidev i '>ram:ufile';call open(ufile,'ram:ufile','r');;do while ~eof(ufile); parse value readln(ufile) with line;    call subword(line,1,3);    if result="Rigid Disk Block" then;do;     if subword(line,8,2)="not found." then;do;     say "UNIT#"i "(Unknown)";     strng="UNIT#"||i||"   (Unknown)";     list ID ULST INSERT POS List_Insert_Bottom STRING strng;     end;    iterate;    end;    if subword(line,1,2)="Can't open" then;do;    say "UNIT#"i  "Not In Use";    strng="UNIT#"||i||"   Not In Use";    list ID ULST INSERT POS List_Insert_Bottom STRING strng;    iterate;    end;    parse value line with "DiskVendor" "=" DVname garb;    if DVname~="" then;do;    DVname=right(DVname,length(DVname)-1);    parse value readln(ufile) with line;    parse value line with "DiskProduct" "=" DPname garb;    DPname=right(DPname,length(DPname)-1);    say "UNIT#"i "  "DVname"   "DPname;    strng="UNIT#"||i||"   "||DVname||"   "||DPname;    list ID ULST INSERT POS List_Insert_Bottom STRING strng;    iterate;    end; end;   call close(ufile);iterate;end;   address command 'delete ram:ufile';call exit;mount:;call getclip(red);if result ~=1 then call stupid;call setclip(devmnt,0);call open(dfile,'ram:devfile','r');do while ~eof(dfile);parse value readln(dfile) with dev;if dev ~="" then;do;address command 'mount 'dev 'from ram:mountfile';end;end;call unitlist;dismount:;call getclip(red);if result ~=1 then call stupid;call setclip(devmnt,0);        i=0;call open(dfile,'ram:devfile','r');do while ~eof(dfile);parse value readln(dfile) with " "name;if name~="" then;do;address command "volname volume "name ">env:vnm";call getenv(vnm);vname=result;name.i=name;vname.i=vname;k=i;say name.i sys  length(name.i) length(sys);if name.i=sys then;do;warnstring="WARNING!!!!!  This Unit contains your SYS: or BOOT partition.  Do you want to DISMOUNT?";   call setclip(uwarn,1);call warning;end;i=i+1;end;end;do j=0 to k;        say name.j;address command 'assign 'name.j ' dismount';end;do j=0 to k;say vname.j;parse value vname.j with vname":"junk;vname=vname":";address command 'assign 'vname 'dismount';end;call unitlist; call exit;exit:;group ID BSY ATTRS showme 0;exit;quit:;call cleanup;address command 'copy env:scsid to sys:prefs/env-archive';address mntprfs quit; exit;mountdevice:;address mntprfs;image ID DINST ATTRS Selected 0; call setclip(devmnt,0);parse value cmd with name","vname;address command 'mount 'name' from ram:mountfile';call unitlist;dismountdevice:;address mntprfs;image ID DINST ATTRS Selected 0; call setclip(devmnt,0);parse value cmd with name","vname;      say sys name length(sys) length(name);if name=sys then;do;warnstring="WARNING!!!!!.  This is your SYS: or BOOT partition.  Do you want to DISMOUNT?";call warning;END;address command 'assign 'name 'dismount';address command 'assign 'vname 'dismount';call unitlist;call exit;warning:;    setvar nme name;    setvar vnme vname;address mntprfs;window ID SWRN TITLE '"WARNING!!!!"' COMMAND '"QUIT"' PORT MNTPRFS;group FRAME;view ID MES STRING warnstring;endgroup;group HORIZ;button ID WYES COMMAND '"mnt.rexx wyes"' LABEL "YES";button ID WNO COMMAND '"mnt.rexx wno"' LABEL 'NO';endgroup;endwindow;call exit;stupid:  say stupid;address mntprfs;strng="READ A UNIT AND TRY AGAIN!!!!";list ID DLST INSERT POS List_Insert_Bottom STRING strng;call exit;setdev:; address mntprfs;image ID DINST ATTRS Selected 1;call getclip(red);if result ~=1 then call stupid;if cmd=mntd then call setclip(devmnt,1);if cmd=dmntd then call setclip(devmnt,2);call exit;dismountsys:;    call setclip(devmnt,0);call getclip(uwarn);if result=1 then;do;call setclip(uwarn,0);call dismountu;end;getvar nme;name=result;getvar vnme;vname=result;address mntprfs;window ID SWRN close;address command 'assign 'name 'dismount';address command 'assign 'vname 'dismount';call unitlist;wno:; call setclip(devmnt,0);address mntprfs;window ID SWRN close;call exit;dismountu:;call setclip(devmnt,0);        i=0;call open(dfile,'ram:devfile','r');do while ~eof(dfile);parse value readln(dfile) with " "name;if name~="" then;do;address command "volname volume "name ">env:vnm";call getenv(vnm);vname=result;name.i=name;vname.i=vname;k=i;i=i+1;end;end;do j=0 to k;        say name.j;address command 'assign 'name.j ' dismount';end;do j=0 to k;say vname.j;parse value vname.j with vname":"junk;vname=vname":";address command 'assign 'vname 'dismount';end;address mntprfs;window ID SWRN close;call unitlist;cancel:;address mntprfs;image ID DINST ATTRS Selected 0;call setclip(devmnt,0);call exit